#!/bin/sh

EXPECTED_ARGS=1
REPO=https://yaoqingka.googlecode.com/svn/trunk


if [ $# -ne $EXPECTED_ARGS ]
then
	echo "Usage: `basename $0` {local/live}"
	exit 1
fi

if [ "$1" = "local" ]; then
	echo local
else
if [ "$1" = "live" ]; then
	echo Deploy yaoqingka to live
	TMP=`mktemp -d`
	cd $TMP
	/usr/bin/svn export https://yaoqingka.googlecode.com/svn/trunk --username=lhj1982 || exit 1
	rsync -vazr --exclude-from='/home/james/projects/yaoqingka/scripts/deploy/rsync_exclude' trunk/ root@yaoqingka:~/yaoqingka/ || exit 3
	cd ..
	rm -rf $TMP || exit 4 
fi
fi

exit 0